<!-- preloader start -->
<div class="head">
    <div id="ht-preloader">
        <div class="loader clear-loader"><img class="img-fluid" src="../assets/images/loader.gif" alt=""></div>
    </div>

    <!-- preloader end -->
    <header class="site-header header-1">

        <div id="header-wrap">
            <div class="container">
                <div class="row">
                    <!--menu start-->
                    <div class="col">
                        <nav class="navbar navbar-expand-lg navbar-light position-static">
                            <a style="width: 64px;height: 64px;" href="/page/index.html">
                                <img class="img-fluid" src="../assets/images/pplogo.png" alt="">
                            </a>
                            <a class="navbar-brand logo" href="/page/index.html">
                                <img class="img-fluid" src="../assets/images/logo001.png" alt="">
                            </a>
                            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-expanded="false" aria-label="Toggle navigation">
                                <span class="navbar-toggler-icon"></span>
                            </button>
                            <div class="collapse navbar-collapse" id="navbarNav">
                                <ul class="navbar-nav ml-auto mr-auto">
                                    <li class="nav-item dropdown position-static">
                                        <a class="nav-link dropdown-toggle" href="#" style="color: red;">猪肉分类</a>
                                        <div class="dropdown-menu w-100">
                                            <!-- Tabs -->
                                            <div class="container p-0">
                                                <div class="row w-100 no-gutters">
                                                    <div class="col-lg-8 p-lg-3">
                                                        <div class="row">
                                                            <div class="col-12 col-md-3 col-sm-6">
                                                                <!-- Heading -->

                                                                <!-- Heading -->
                                                                <div class="mb-2 font-w-5 text-link">300天喂养</div>
                                                                <!-- Links -->
                                                                <ul class="list-unstyled mb-6 mb-md-0">
                                                                    <li><a href="http://127.0.0.1:8888/goods/28">特价去皮五花肉</a></li>
                                                                    <li><a href="http://127.0.0.1:8888/goods/9">猪肉 前尖</a></li>
                                                                    <li><a href="http://127.0.0.1:8888/goods/6">五花肉猪后腿</a></li>
                                                                    <li><a href="http://127.0.0.1:8888/goods/18">黑猪肉年货礼盒</a></li>
                                                                </ul>
                                                            </div>
                                                            <div class="col-12 col-md-3 col-sm-6">
                                                                <!-- Heading -->
                                                                <div class="mb-2 font-w-5 text-link">特色黑猪</div>
                                                                <!-- Links -->
                                                                <ul class="list-unstyled mb-6 mb-md-0">
                                                                    <li><a href="http://127.0.0.1:8888/goods/5">直隶黑猪棒骨</a></li>
                                                                    <li><a href="http://127.0.0.1:8888/goods/8">里脊肉</a></li>
                                                                    <li><a href="http://127.0.0.1:8888/goods/7">去皮五花肉</a></li>
                                                                    <li><a href="http://127.0.0.1:8888/goods/13"> 黑猪肉馅</a></li>
                                                                </ul>
                                                            </div>
                                                            <div class="col-12 col-md-3 col-sm-6">
                                                                <!-- Heading -->
                                                                <div class="mb-2 font-w-5 text-link">熟食腊味</div>
                                                                <!-- Links -->
                                                                <ul class="list-unstyled mb-0">
                                                                    <li><a href="http://127.0.0.1:8888/goods/19">烟熏咸腊肉腊肠</a></li>
                                                                    <li><a href="http://127.0.0.1:8888/goods/20">腊味礼盒</a></li>
                                                                    <li><a href="http://127.0.0.1:8888/goods/21"> 广式腊味香肠</a></li>
                                                                    <li><a href="http://127.0.0.1:8888/goods/24">广式特产大礼包</a></li>
                                                                </ul>
                                                            </div>
                                                            <div class="col-12 col-md-3 col-sm-6">
                                                                <!-- Heading -->
                                                                <div class="mb-2 font-w-5 text-link"  style="color: #a71d2a">学IT选达内</div>
                                                                <!-- Links -->
                                                                <ul class="list-unstyled mb-0">
                                                                    <li><a href="http://www.tedu.cn/"  style="color: #a71d2a">达内-美国上市机构</a></li>
                                                                    <li><a href="http://www.tedu.cn/"  style="color: #a71d2a">开设26大职业课程</a></li>
                                                                    <li><a href="http://www.tedu.cn/"  style="color: #a71d2a">IT学院</a></li>
                                                                    <li><a href="http://www.tedu.cn/"  style="color: #a71d2a">设计、运营学院</a></li>
                                                                </ul>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="col-lg-4 d-none d-lg-block pr-2"><a href="http://www.tedu.cn/"><img
                                                            class="img-fluid rounded-bottom rounded-top"
                                                            src="../assets/images/teduh.jpg" alt="..."></a></div>
                                                </div>
                                            </div>
                                        </div>
                                    </li>
                                    </li>
                                    <li class="nav-item dropdown"><a class="nav-link dropdown-toggle"
                                                                     href="javascript:void(0)" data-toggle="dropdown"
                                                                     onclick="jumpToItemList(this)" id="-1">热销产品</a>
                                        <ul class="dropdown-menu" id="CateMenu">

                                        </ul>
                                    </li>
                                    <li class="nav-item "><a class="nav-link " href="/page/recipesList">特色菜谱</a>

                                    </li>
                                    <li class="nav-item"><a class="nav-link" href="about-us.html">关于我们</a></li>
                                </ul>
                            </div>
                            <div class="right-nav align-items-center d-flex justify-content-end">
                                <a href="login.html" class="username">现在登录 &nbsp;</a>&nbsp;&nbsp;&nbsp;
                                <a href="signup.html" class="register" style="color: #000000;">&nbsp;注册</a>
                                <div class="right-nav align-items-center d-flex justify-content-end">
                                    <div class="mr-1 mr-sm-3 search-block"> <a href="javascript:void(0);" class="search_trigger ml-3"><i class="las la-search"></i></a>
                                        <div class="search_wrap container"> <span class="close-search"><i class="ion-ios-close-empty"></i></span>
                                            <form action="javascript:void(0)">
                                                <input type="text" placeholder="Search" class="form-control" id="search_input" STYLE="color: black">
                                                <button class="search_icon"><i class="las la-search"></i></button>
                                            </form>
                                        </div>
                                    </div>
                                <a class="mr-1 mr-sm-3" href="my-account.html"><i class="las la-user-alt"></i></a>
                                <div class="dropdown cart_dropdown"><a class="d-flex align-items-center"
                                                                       href="/page/shopping-cart.html"> <span
                                        class="bg-white pr-3 pl-0 py-1 rounded" data-cart-items="♥"> <i
                                        class="las la-shopping-bag"></i> </span> </a></div>
                            </div>
                        </nav>
                    </div>
                    <!--menu end-->
                    <!--menu end-->
                </div>
            </div>
        </div>
    </header>

    <!--header end-->

    <!--header end-->
    <!--header end-->
    <!-- inject js start -->

    <script src="../assets/js/jquery-3.5.1.min.js"></script>
    <script src="../assets/js/popper.min.js"></script>
    <script src="../assets/js/bootstrap.min.js"></script>
    <script src="../assets/js/owl.carousel.min.js"></script>
    <script src="../assets/js/light-slider.js"></script>
    <script src="../assets/js/parallax.js"></script>
    <script src="../assets/js/magnific-popup.min.js"></script>
    <script src="../assets/js/jquery.countdown.min.js"></script>
    <script src="../assets/js/jquery.dd.min.js"></script>
    <script src="../assets/js/validator.js"></script>
    <script src="../assets/js/wow.js"></script>
    <script src="../assets/js/theme-script.js"></script>
    <script>
        $(function () {
            reShowCateMenu();
        });

        //请求商品的目录回显到CateMenu中
        function reShowCateMenu() {
            $.ajax({
                url: "/cate/doFindAllCategory",
                success: (result) => {
                    let data = result.data;
                    let cateMenu = $("#CateMenu");
                    for (let cate of data) {
                        if (cate.parentId == null) {
                            continue;
                        }
                        let str = "<li> <a href='javascript:void(0)' id='" + cate.id + "' onclick='jumpToItemList(this)'>" + cate.name + "</a></li>";
                        cateMenu.append(str);
                    }
                }
            })
        }
        //商品页面的跳转
        function jumpToItemList(obj) {
            let id = $(obj).prop("id");
            localStorage.clear();
            localStorage.setItem("categoryId", id);
            location.href = "/page/itemList";
        }

        //搜索框进行搜索
        $(".search_icon").on("click",function () {
            let title = $("#search_input").val();
            localStorage.setItem("title", title);
            location.href="/page/itemList";
        })
    </script>
    <script>
        function getCookie(cookieName) {
            var strCookie = document.cookie;
            var arrCookie = strCookie.split("; ");
            for (var i = 0; i < arrCookie.length; i++) {
                var arr = arrCookie[i].split("=");
                if (cookieName == arr[0]) {
                    console.log(arr[1]);
                    $(".username").html(arr[1]);
                    $(".username").attr("href","/page/my-account.html");
                    $(".register").html("退出");
                    $(".register").attr("href","/user/page/logout")
                    return arr[1];
                }else if(cookieName !== arr[0]){
                    $(".username").html("现在登录");
                    $(".username").attr("href","/page/login.html");
                    $(".register").attr("href","/page/signup.html");
                }
            }
            return "";
        }
        $(document).ready(function () {
            getCookie("PAGE_TICKET");
        });
    </script>
</div>